<!doctype html>
<html class="no-js">
<head>
	<include file="./Apps/WebApp/View/default/common_meta.html" />
	<title>修改内容</title>

	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/AmazeUI/assets/css/amazeui.min.css">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/common.css?v={$WST_V}">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/orders_management.css?v={$WST_V}">
	<include file="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/common_js.html" />






	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="yes" name="apple-touch-fullscreen">
	<meta content="telephone=no,email=no" name="format-detection">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebAPP/View/default/css/edit_regain.css" type="text/css">

	<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/photoNewBook/jquery-1.10.2.min.js"></script>

	<script type="text/javascript">

		!function(a,b){function c(){var b=f.getBoundingClientRect().width;b/i>540&&(b=540*i);var c=b/10;f.style.fontSize=c+"px",k.rem=a.rem=c}var d,e=a.document,f=e.documentElement,g=e.querySelector('meta[name="viewport"]'),h=e.querySelector('meta[name="flexible"]'),i=0,j=0,k=b.flexible||(b.flexible={});if(g){console.warn("将根据已有的meta标签来设置缩放比例");var l=g.getAttribute("content").match(/initial\-scale=([\d\.]+)/);l&&(j=parseFloat(l[1]),i=parseInt(1/j))}else if(h){var m=h.getAttribute("content");if(m){var n=m.match(/initial\-dpr=([\d\.]+)/),o=m.match(/maximum\-dpr=([\d\.]+)/);n&&(i=parseFloat(n[1]),j=parseFloat((1/i).toFixed(2))),o&&(i=parseFloat(o[1]),j=parseFloat((1/i).toFixed(2)))}}if(!i&&!j){var p=(a.navigator.appVersion.match(/android/gi),a.navigator.appVersion.match(/iphone/gi)),q=a.devicePixelRatio;i=p?q>=3&&(!i||i>=3)?3:q>=2&&(!i||i>=2)?2:1:1,j=1/i}if(f.setAttribute("data-dpr",i),!g)if(g=e.createElement("meta"),g.setAttribute("name","viewport"),g.setAttribute("content","initial-scale="+j+", maximum-scale="+j+", minimum-scale="+j+", user-scalable=no"),f.firstElementChild)f.firstElementChild.appendChild(g);else{var r=e.createElement("div");r.appendChild(g),e.write(r.innerHTML)}a.addEventListener("resize",function(){clearTimeout(d),d=setTimeout(c,300)},!1),a.addEventListener("pageshow",function(a){a.persisted&&(clearTimeout(d),d=setTimeout(c,300))},!1),"complete"===e.readyState?e.body.style.fontSize=12*i+"px":e.addEventListener("DOMContentLoaded",function(){e.body.style.fontSize=12*i+"px"},!1),c(),k.dpr=a.dpr=i,k.refreshRem=c,k.rem2px=function(a){var b=parseFloat(a)*this.rem;return"string"==typeof a&&a.match(/rem$/)&&(b+="px"),b},k.px2rem=function(a){var b=parseFloat(a)/this.rem;return"string"==typeof a&&a.match(/px$/)&&(b+="rem"),b}}(window,window.lib||(window.lib={}));</script>
	<style type="text/css">
	.return_right,.return_center{
		width:1.466667rem;
		height:0.586667rem;
		float: right;
	}
	.return_left{
		width:2.133333rem;
		height:0.586667rem;
		float: right;
	}
	.regain_container,.regain_zhao{
		position: relative;
	}
	.img_float{
		position: relative;
		float: left;
	}
	fieldset{
		border:0;
	}
	.am-panel-default{
		border:0;
	}
	.test{
		width: 2rem;
		height:2rem;
		background-color: #00bb9c;

	}
</style>






<div class="test">上传</div>


<!-- 微信跨域传图片用access-->
<input type="hidden" id="accessToken" value="{$accessToken}">






</head>
<body>



<include file="./Apps/WebApp/View/default/common_js.html" />
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/ajax.js"></script>
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/order_complains.js?v={$WST_V}"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>

    /**
     *
     * Base64 encode / decode
     *
     *
     */
    function Base64() {

        // private property
        _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

        // public method for encoding
        this.encode = function (input) {
            var output = "";
            var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
            var i = 0;
            input = _utf8_encode(input);
            while (i < input.length) {
                chr1 = input.charCodeAt(i++);
                chr2 = input.charCodeAt(i++);
                chr3 = input.charCodeAt(i++);
                enc1 = chr1 >> 2;
                enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
                enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
                enc4 = chr3 & 63;
                if (isNaN(chr2)) {
                    enc3 = enc4 = 64;
                } else if (isNaN(chr3)) {
                    enc4 = 64;
                }
                output = output +
                    _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
                    _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
            }
            return output;
        }

        // public method for decoding
        this.decode = function (input) {
            var output = "";
            var chr1, chr2, chr3;
            var enc1, enc2, enc3, enc4;
            var i = 0;
            input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
            while (i < input.length) {
                enc1 = _keyStr.indexOf(input.charAt(i++));
                enc2 = _keyStr.indexOf(input.charAt(i++));
                enc3 = _keyStr.indexOf(input.charAt(i++));
                enc4 = _keyStr.indexOf(input.charAt(i++));
                chr1 = (enc1 << 2) | (enc2 >> 4);
                chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
                chr3 = ((enc3 & 3) << 6) | enc4;
                output = output + String.fromCharCode(chr1);
                if (enc3 != 64) {
                    output = output + String.fromCharCode(chr2);
                }
                if (enc4 != 64) {
                    output = output + String.fromCharCode(chr3);
                }
            }
            output = _utf8_decode(output);
            return output;
        }

        // private method for UTF-8 encoding
        _utf8_encode = function (string) {
            string = string.replace(/\r\n/g,"\n");
            var utftext = "";
            for (var n = 0; n < string.length; n++) {
                var c = string.charCodeAt(n);
                if (c < 128) {
                    utftext += String.fromCharCode(c);
                } else if((c > 127) && (c < 2048)) {
                    utftext += String.fromCharCode((c >> 6) | 192);
                    utftext += String.fromCharCode((c & 63) | 128);
                } else {
                    utftext += String.fromCharCode((c >> 12) | 224);
                    utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                    utftext += String.fromCharCode((c & 63) | 128);
                }

            }
            return utftext;
        }

        // private method for UTF-8 decoding
        _utf8_decode = function (utftext) {
            var string = "";
            var i = 0;
            var c = c1 = c2 = 0;
            while ( i < utftext.length ) {
                c = utftext.charCodeAt(i);
                if (c < 128) {
                    string += String.fromCharCode(c);
                    i++;
                } else if((c > 191) && (c < 224)) {
                    c2 = utftext.charCodeAt(i+1);
                    string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                    i += 2;
                } else {
                    c2 = utftext.charCodeAt(i+1);
                    c3 = utftext.charCodeAt(i+2);
                    string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                    i += 3;
                }
            }
            return string;
        }
    }





    var WST = ThinkPHP = window.Think = {
        "ROOT"   : "__ROOT__",
        "APP"    : "__APP__",
        "PUBLIC" : "__PUBLIC__",
        "DEEP"   : "{:C('URL_PATHINFO_DEPR')}",
        "MODEL"  : ["{:C('URL_MODEL')}", "{:C('URL_CASE_INSENSITIVE')}", "{:C('URL_HTML_SUFFIX')}"],
        "VAR"    : ["{:C('VAR_MODULE')}", "{:C('VAR_CONTROLLER')}", "{:C('VAR_ACTION')}"],
        "DOMAIN" : "{:WSTDomain()}",
        "CITY_ID" : "{$currArea['areaId']}",
        "CITY_NAME" : "{$currArea['areaName']}",
        "DEFAULT_IMG": "{:WSTDomain()}/{$CONF['goodsImg']}",
        "MALL_NAME" : "{$CONF['mallName']}",
        "SMS_VERFY"  : "{$CONF['smsVerfy']}",
        "PHONE_VERFY"  : "{$CONF['phoneVerfy']}",
        "IS_LOGIN" :"{$WST_IS_LOGIN}",
        "WST_STYLE" :"{$WST_STYLE}"
    }

    wx.config({
        debug: false,
        appId: '<?php echo $signPackage["appId"];?>',
        timestamp:'<?php echo $signPackage["timestamp"];?>',
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',
        signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: [
            // 所有要调用的 API 都要加到这个列表中
            'startRecord','stopRecord','translateVoice','uploadVoice','chooseImage','previewImage','uploadImage','getLocalImgData'
        ]
    });

    $('.test').click(function() {

        wx.chooseImage({
            count: 1, // 默认9
            sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
            success: function (res) {
                var localIds = res.localIds;// 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
                // alert(JSON.stringify(res));
                var access = $('#accessToken').val();
                //images.serverId = [];
                //   alert(2222);

                var ua = navigator.userAgent.toLowerCase();
                if (ua.match(/iphone/i) == "micromessenger") {
                    var ios = true;
                } else {
                    var ios = false;
                }
                if (ios || window.__wxjs_is_wkwebview) { //ios需要进一步处理

                    IosUpload(localIds[0])
                }else{
                    AndroidUpload(localIds[0]);
                }



                function IosUpload(localId){
					var localId1=localId.toString();
                    wx.uploadImage({
                        localId: localId1,
                        isShowProgressTips: 1,
                        success: function (res) {
                           var media_id=res.serverId;
                            wx.getLocalImgData({
                                localId: localId1,
                                isShowProgressTips: 1,
                                success: function (res) {
                                    var localData = res.localData; // localData是图片的base64数据，可以用img标签显示
                                    localData = localData.replace('jgp', 'jpeg');
                                    $.ajax({
                                        type: 'POST',
                                        // url: 'http://www.youyiku-yishu.cn/WechatUpload.php',
                                        url:" {:U('WebApp/PhotoBooks/getExifImformation')}",
                                        data: {'media_id':media_id, 'access': access},
                                        // data: {'media_id': res.serverId},
                                        dataType: 'json',
                                        success: function (data) {
                                            alert(JSON.stringify(data));
                                        }
                                    })


                                },
                                fail: function (res) {
                                    //alert('该图片暂时无法查看')
                                    console.log(res);
                                }
                            })


						}})


                }

                function AndroidUpload(localId){
                    access=$('#accessToken').val();
                    wx.uploadImage({
                        localId: localId.toString(),
                        isShowProgressTips: 1,
                        success: function (res) {

                            // alert(1111);
                            //images.serverId.push(res.serverId);
                            // alert(JSON.stringify(res));;alert(access)
                            //下载
                            $.ajax({
                                type: 'POST',
                                // url: 'http://www.youyiku-yishu.cn/WechatUpload.php',
                                url:" {:U('WebApp/PhotoBooks/getExifImformation')}",
                                data: {'media_id': res.serverId, 'access': access},
                                // data: {'media_id': res.serverId},
                                dataType: 'json',
                                success: function (data) {
                                    alert(JSON.stringify(data));
                                }
                            })
                        },
                        fail: function (res) {
                            wstMsg(JSON.stringify(res));
                            // alert(JSON.stringify(res));
                        }
                    })
                }


            }
        })

    })

	window.onload=function(){
        var availHeight=window.screen.availHeight;
        var  availWidth=window.screen.availWidth;
		alert(availHeight);alert(availWidth);

	}




</script>
<include file="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/common_js.html" />
<script src="http://www.youyiku-yishu.cn/Public/js/think.js"></script>
</script>













</body>
</html>